﻿using System;

namespace FDEE.Model
{
    /// <summary>
    /// 两端带弯钩直线
    /// </summary>
    public class MDRRebarRecord : RebarBase
    {
        //public int A,h;
        /// <summary>
        /// 标准箍筋
        /// </summary>
        /// <param name="mBarMark"></param>
        /// <param name="sBarMark"></param>
        /// <param name="cBarMark"></param>
        /// <param name="diameter"></param>
        /// <param name="quantity"></param>
        /// <param name="shapeConfig"></param>
        /// <param name="a">A</param>
        /// <param name="h">hh</param>
        /// <param name="rr">内半径，默认为0时，按规范取值</param>
        public MDRRebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter,
            int quantity,eShapeType shapeConfig,int a, int hh,int rr=0):base(mBarMark,sBarMark,cBarMark,diameter,quantity,shapeConfig)
        {
            if(a<0||h<0||Lx<0)
            {
                throw new Exception("箍筋结果异常请查询原因！");
            }
            A = a;
            h = hh;
            this.d = PublicEnumItems.GeteDBData(diameter.ToString());
            if (rr==0)
            {
                r = RebarKnowledge.GetRadiusForSrirrup(diameter);
            }
            else
            {
                r = rr;
            }
            //Lx = RebarKnowledge.GetLxNew(diameter);
            this.Formula = "L=A+2h";
        }

        public override void SetLength()
        {
            //Length=(2 * (A + B) + Lx)*0.001;
            Length = Math.Round((A + h*2) * 0.001, 3, MidpointRounding.AwayFromZero);
        }
    }

}
